import {NextResponse} from "next/server";
import db from "@/db";

// GET => /api/articles
export async function GET(request: Request) {
}

// POST => /api/articles
export async function POST(request: Request) {
    const result = await request.json();
    await db.update(({posts}) => posts.push({
        id: Math.random().toString(36).slice(-8),
        ...result
    }))
    return NextResponse.json({
        code: 200,
        message: "success",
        data: result
    });
}
